module.exports = app => {

    //挂载 express 路由
    const express = require("express");
    const router = express.Router({
        mergeParams: true //表示合并url参数
    });

    //引入模型
    const Holiday = require('./../models/Holiday.js');//离归校时间


    //请求离归校时间全部信息
    router.get('/holiday/:id', async (req, res) => {
        console.log('---根据id进行请求离归校时间信息---');

        const item = await Holiday.findById(req.params.id);
        res.send(item);

    });

    router.get('/holiday', async (req, res) => {
        let date = new Date();
        console.log(date + '---' + req.ip + '---请求离归校时间信息---');

        const item = await Holiday.find();
        res.send(item);

    });

    app.use('/user/api', router);

}